package xin.nick.demo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {

    @Autowired
    private NickConfig nickConfig;

    @Value("${xin.nick.name}")
    private String nickName;

    @Autowired
    private Environment environment;

    @Autowired
    private HelloService helloService;

    @Autowired
    private UserClient userClient;

    @GetMapping("/hello")
    public String hello() {
        String result = "222?hello" + nickConfig.getName() + "\n"
                + nickName + "\n"
                + userClient.getName() + "\n"
                + environment.getProperty("xin.nick.name") + "\n"
                + environment.getProperty("spring.profiles.active");

        helloService.saveHello();
        System.out.println("dadaaa");


        return result;
    }
}